package my.design.dependence;

/**
 * @author zp
 * @version 1.0
 * @description: TODO
 * @date 2022/9/27 19:41
 */
public class DependenceInversion {
    public static void main(String[] args) {
        Person person = new Person();
        person.receive(new Email());
        person.receive(new WeChat());
    }
}

interface Info{
    String getInfo();
}

class Email implements Info{


    public String getInfo() {
        return "Receive Email";
    }
}

class WeChat implements Info{


    public String getInfo() {
        return "Receive WeChat";
    }
}

//person 接受信息
class Person {

    public void receive(Info info) {
        System.out.println(info.getInfo());
    }
}
